package com.css.common.core.enums;

import lombok.Getter;

/**
 * @author WFY
 * @description 回到状态
 * @date 2024/8/14
 */

@Getter
public enum CallbackStatusEnum {

    /**
     * ****************************** 公众号支付结果
     */

    //未知状态
    UNKNOWN("UNKNOWN", "未知状态"),

    // 支付成功
    TRADE_SUCCESS("TRADE_SUCCESS", "支付成功"),

    // 退款成功
    TRADE_REFUND("TRADE_REFUND", "退款成功"),

    /********************************** C扫B支付结果 *****************************************************/

    PAID("PAID", "支付"),

    UNPAID("UNPAID", "未支付"),

    REFUND("REFUND", "退款"),

    CLOSED("CLOSED", "账单关闭");

    private final String code;

    private final String desc;

    CallbackStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CallbackStatusEnum getInstance(String code) {
        for (CallbackStatusEnum e : CallbackStatusEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return null;
    }

}
